package com.hippy.erya.sys.modular.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hippy.erya.base.pojo.node.ZTreeNode;
import com.hippy.erya.sys.modular.system.entity.Dict;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 基础字典 Mapper 接口
 * </p>
 *
 * @author stylefeng
 * @since 2019-03-13
 */
@Repository
public interface DictMapper extends BaseMapper<Dict> {

    /**
     * 获取ztree的节点列表
     */
    List<ZTreeNode> dictTree(@Param("dictTypeId") Long dictTypeId);

    /**
     * where parentIds like ''
     */
    List<Dict> likeParentIds(@Param("dictId") Long dictId);

    /**
     * code
     */
    List<Dict> selectByCode(@Param("dict") String dict);

    /**
     * code
     */
    Dict selectByCodeKey(@Param("dict") String dict,
                         @Param("key") String key);

    Dict selectByCodeName(@Param("code") String code,
                         @Param("name") String name);

    Dict queryDictByCode(@Param("code") String code);
}
